Skip to content

Conversation

@AA-Turner
Copy link
Member

Resolves #12601

cc: @2bndy5 -- Brendan, if you'd be able to test this PR I would be grateful.

A

@2bndy5
Copy link

2bndy5 commented Jul 19, 2024

Using the zip from #12601 thread, I now get the following nitpicky warnings:

path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig:1: WARNING: py:class reference target not found: pydantic.functional_validators.AfterValidator
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig:1: WARNING: py:class reference target not found: docutils.nodes.make_id
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.classes:1: WARNING: py:class reference target not found: pydantic.functional_validators.AfterValidator
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.classes:1: WARNING: py:class reference target not found: docutils.nodes.make_id
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.title:1: WARNING: py:class reference target not found: FieldInfo
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.title:1: WARNING: py:class reference target not found: NoneType

after adding to conf.py:

extensions = [
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
]
autodoc_mock_imports = [
    "docutils",
    "pydantic",
]
intersphinx_mapping = {
    "python": ("https://docs.python.org/3", None),
}

I get the following nitpicky warnings:

path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.classes:1: WARNING: py:class reference target not found: pydantic.AfterValidator
path/to/issue#12601/annotated.py:docstring of annotated.CustomAdmonitionConfig.title:1: WARNING: py:class reference target not found: pydantic.Field

with the following HTML output:
image
Overall, I think this is a considerable improvement. Thanks!

@AA-Turner AA-Turner force-pushed the fix-annotated-autodoc branch from 296ee42 to aafa5fd Compare July 20, 2024 03:27
@AA-Turner AA-Turner force-pushed the fix-annotated-autodoc branch from aafa5fd to db56cef Compare July 20, 2024 03:44
@AA-Turner AA-Turner merged commit 2bd973e into sphinx-doc:master Jul 20, 2024
@AA-Turner AA-Turner deleted the fix-annotated-autodoc branch July 20, 2024 10:28
@AA-Turner
Copy link
Member Author

Thanks @2bndy5!

A

@2bndy5
Copy link

2bndy5 commented Jul 20, 2024

Thank you for taking the lead on this!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sphinx 7.4: autodoc: typing.Annotated failure with pydantic

2 participants